.\"
.\"	$OpenBSD: SSL_pending.3,v 1.2 2014/12/02 14:11:01 jmc Exp $
.\"
.Dd $Mdocdate: December 2 2014 $
.Dt SSL_PENDING 3
.Os
.Sh NAME
.Nm SSL_pending
.Nd obtain number of readable bytes buffered in an SSL object
.Sh SYNOPSIS
.In openssl/ssl.h
.Ft int
.Fn SSL_pending "const SSL *ssl"
.Sh DESCRIPTION
.Fn SSL_pending
returns the number of bytes which are available inside
.Fa ssl
for immediate read.
.Sh NOTES
Data are received in blocks from the peer.
Therefore data can be buffered inside
.Fa ssl
and are ready for immediate retrieval with
.Xr SSL_read 3 .
.Sh RETURN VALUES
The number of bytes pending is returned.
.Sh SEE ALSO
.Xr ssl 3 ,
.Xr SSL_read 3
.Sh BUGS
.Fn SSL_pending
takes into account only bytes from the TLS/SSL record that is currently being
processed (if any).
If the
.Vt SSL
object's
.Em read_ahead
flag is set, additional protocol bytes may have been read containing more
TLS/SSL records; these are ignored by
.Fn SSL_pending .
.Pp
Up to OpenSSL 0.9.6,
.Fn SSL_pending
does not check if the record type of pending data is application data.
